package cn.edu.sjtu.stap.cg;

import org.aspectj.ajdt.internal.compiler.ast.*;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.*;

public class CgAdvised extends CgEdge {
    private static final long serialVersionUID = 1L;
    
    public CgAdvised() {
        super();
    }
    
    public void setASTNode(ASTNode node) {
        if (node instanceof PointcutDeclaration) {
            super.setASTNode(node);
        } else {
            throw new IllegalArgumentException("Uncompatible AST node!");
        }
    }

    // TODO: Return a meaningful string.
    public String toString() {
        StringBuffer sb = new StringBuffer();
        
        sb.append("<Advised Id: ");
        sb.append(this.getId());
        sb.append(", Shadow: Node ");
        sb.append(this.getSourceNode().getId());
        sb.append(", Advice: Node ");
        sb.append(this.getDestinationNode().getId());
        sb.append(">");
        
        return sb.toString();
    }
}
